<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    // console.log(history.back());
    // console.log(history.forward());
    // console.log(history.go(3));
    // console.log(screen.availWidth, screen.availHeight);
    // console.log(screen.width, screen.height);
    // console.log(navigator.onLine);
    // console.log(navigator.userAgent);
    // document.write(navigator.userAgent + "<br>");
    // document.write(screen.availWidth, "&emsp;" + screen.availHeight + "<br>");
    // document.write(screen.width, "&emsp;" + screen.height + "<br>");


    //文档可视宽高
    //常规写法
    // console.log(document.documentElement.clientWidth, document.documentElement.clientHeight);
    // //ie7以下写法
    // console.log(document.body.clientWidth, document.body.clientHeight);

    // //兼容写法1
    // var clientWidth = !(document.documentElement.clientWidth) ? document.body.clientWidth : document.documentElement.clientWidth;
    // var clientHeight = !(document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight;
    // console.log(clientWidth, clientHeight);

    // //兼容写法2
    // var clientWidth = document.documentElement.clientWidth || document.body.clientWidth;
    // var clientHeight = document.documentElement.clientHeight || document.body.clientHeight;
    // console.log(clientWidth, clientHeight);

    // console.log(0 || 2); //2
    // console.log(2 || 0); //2
    // console.log(0 || 0); //0
    // console.log(0 && 2); //0
    // console.log(1 && 2); //2
    // console.log(1 && 0); //0

    //文档实际宽高scrollWidth,scrollHight
    var scrollWidth = document.documentElement.scrollWidth || document.body.scrollWidth;
    var scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
    console.log(scrollWidth, scrollHeight);
    
    // 滚动条距离文档顶部/左侧 的位置
    // 滚动条距离文档顶部的位置就是页面上升的高度
    // 滚动的最大位置 = 文档实际宽高 - 文档可视宽高

</script>

</html>